<template>
	<view class="page" :style="themeColor">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex changePwdPhone_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-stretch justify-between changePwdPhone_fd0_0'>
				<view class='flex flex-wrap align-center changePwdPhone_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<text class='fu-iconfont2  changePwdPhone_fd0_0_c0_c0'>&#xe794;</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='changePwdPhone_fd0_0_c1_c0'>修改密码</text>
				</view>
				<view class='flex align-center justify-end changePwdPhone_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---修改密码-手机验证-表单flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch changePwdPhone_flex_1">
			<view class='flex flex-wrap align-center changePwdPhone_fd1_0'>
				<text class='changePwdPhone_fd1_0_c0'>新密码</text>
				<input class='flex-sub changePwdPhone_fd1_0_c1' type="text" :focus='true' placeholder="请输入新密码"
					confirm-type="done" :maxlength="12" :password='true' placeholder-style="color:#999;font-size:32rpx"
					v-model="newPwd" />
			</view>
			<view class='flex flex-wrap align-center changePwdPhone_fd1_1'>
				<text class='changePwdPhone_fd1_1_c0'>确认新密码</text>
				<input class='flex-sub changePwdPhone_fd1_1_c1' type="text" :focus='true' placeholder="请再次输入新密码"
					confirm-type="done" :maxlength="12" :password='true' placeholder-style="color:#999;font-size:32rpx"
					v-model="qrPwd" />
			</view>
		</view>
		<!---修改密码-手机验证-表单flex布局结束-->
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-center benben-flex-layout">
			<button class='changePwdPhone_fd2_0' @tap.stop="checkPwdFunc()">完成</button>
		</view>
		<!---flex布局flex布局结束-->


	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"newPwd": "",
				"qrPwd": "",
				"mobile": "",
				"code": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				mobile,
				code
			} = options
			if (mobile !== undefined) this.mobile = mobile
			if (code !== undefined) this.code = code
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//校验密码
			async checkPwdFunc() {
				if (!validate(this.newPwd, 'require')) {
					this.$message.info('请输入新密码');
					return false;
				}
				if (!validate(this.newPwd, 'password')) {
					this.$message.info('请输入新密码（6~12位字母+数字）');
					return false;
				}
				if (!validate(this.qrPwd, 'require')) {
					this.$message.info('请输入确认密码');
					return false;
				}
				if (!validate(this.qrPwd, 'password')) {
					this.$message.info('请输入确认密码（6~12位字母+数字');
					return false;
				}
				if (!(this.newPwd == this.qrPwd)) {
					this.$message.info('两次输入密码不一致');
					return false;
				}
				//请求方法
				//数据验证

				let data5caeeba9866aa = await this.$api.post(global.apiUrls.post643671f286119, {
					password: this.newPwd,
					password_code: this.qrPwd
				});
				if (data5caeeba9866aa.data.code != 1) {
					this.$message.info(data5caeeba9866aa.data.msg);
					return
				}


				setTimeout(() => {
					this.$store.commit('logout')
					this.toLoginDiy();
				}, 1000)
				this.$message.info('修改成功请重新登录');
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(246, 247, 249, 1);
		background-size: 100% auto !important;
	}

	.changePwdPhone_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.changePwdPhone_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 100rpx;
	}

	.changePwdPhone_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.changePwdPhone_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.changePwdPhone_fd0_0_c0 {
		width: 100rpx;
	}

	.changePwdPhone_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.changePwdPhone_flex_1 {
		background: #fff;
		font-size: 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.changePwdPhone_fd1_1_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.changePwdPhone_fd1_1_c0 {
		font-size: 32rpx;
		font-weight: 500;
		font-style: normal;
		color: #333333;
		width: 182rpx;
		line-height: 32rpx;
	}

	.changePwdPhone_fd1_1 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.changePwdPhone_fd1_0_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.changePwdPhone_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		font-style: normal;
		color: #333333;
		width: 182rpx;
		line-height: 32rpx;
	}

	.changePwdPhone_fd1_0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.changePwdPhone_fd2_0 {
		background: #4781f5;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		margin: 80rpx 0rpx 0rpx 0rpx;
	}
</style>